/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.util.List;
import javax.persistence.EntityManager;
import Bean.Escola;
import util.JPAUtil;

/**
 *
 * @author alexandre
 */
public class LabDAO {
    
    
    public void add(Escola lab){
        EntityManager em = JPAUtil.getInstance().getEntityManager();
        em.persist(lab);
    }
    
    public void edit(Escola lab){
        EntityManager em = JPAUtil.getInstance().getEntityManager();
        em.merge(lab);
    }
    
    public void del(Escola lab){
        EntityManager em = JPAUtil.getInstance().getEntityManager();
        Escola lab2 = em.merge(lab);
        em.remove(lab2);
    }
    
    public Escola getLaboratorioID(int id){
        return JPAUtil.getInstance().getEntity(Escola.class, id);
        
    }
    
    public List<Escola> getAllLaboratorio(){
        return JPAUtil.getInstance().getList(Escola.class, "SELECT lab FROM Laboratio lab");
    }
    
    
    
}
